import { EntitySchema } from '@mikro-orm/core';

export class LePromoterLevel {
  id!: string;
  level!: boolean;
  name!: string;
  first!: string;
  second!: string;
  third!: string;
  isAuto: boolean = false;
  updateType: boolean = true;
  condition!: string;
  AppID!: string;
  merchantId!: string;
  createdTime?: number = 0;
  updatedTime?: number = 0;
  deletedTime?: number = 0;
  isDeleted?: number = 0;
}

export const LePromoterLevelSchema = new EntitySchema({
  class: LePromoterLevel,
  properties: {
    id: { primary: true, type: 'string', columnType: 'bigint' },
    level: { type: 'boolean' },
    name: { type: 'string', length: 8 },
    first: { type: 'string', columnType: 'numeric(10,2)', defaultRaw: `0.00` },
    second: { type: 'string', columnType: 'numeric(10,2)', defaultRaw: `0.00` },
    third: { type: 'string', columnType: 'numeric(10,2)', defaultRaw: `0.00` },
    isAuto: { type: 'boolean', default: false },
    updateType: { type: 'boolean', default: true },
    condition: { type: 'string', length: 512 },
    AppID: { type: 'string', fieldName: 'AppID', length: 50 },
    merchantId: { type: 'string', columnType: 'bigint' },
    createdTime: { type: 'number', nullable: true, default: 0 },
    updatedTime: { type: 'number', nullable: true, default: 0 },
    deletedTime: { type: 'number', nullable: true, default: 0 },
    isDeleted: { type: 'number', columnType: 'tinyint', nullable: true, default: 0 },
  },
});
